﻿using System.Collections;
using System.Windows.Forms;

/// <summary>
/// tree 排序
/// </summary>
public class NodeSorter : IComparer
{
    // Compare the length of the strings, or the strings
    // themselves, if they are the same length.
    public int Compare(object x, object y)
    {
        TreeNode tx = x as TreeNode;
        TreeNode ty = y as TreeNode;

        //// Compare the length of the strings, returning the difference.
        //if (tx.Text.Length != ty.Text.Length)
        //    return tx.Text.Length - ty.Text.Length;

        // If they are the same length, call Compare.
        return string.Compare(tx.Text, ty.Text);
    }
}